package com.wiscamp.ninechapters.common.exception;

/**
 * 服务异常
 *
 * @author yifeng
 */
public class AppServiceException extends ApplicationException {
    /**
     * 序列化版本号
     */
    private static final long serialVersionUID = 6840196332067104127L;

    /**
     * 内部原生异常
     */
    private Exception innerException;

    /**
     * 业务异常代码
     */
    private String code;

    /**
     * 业务异常数据
     */
    private Object data;

    public AppServiceException(Exception innerException, String code, Object data) {
        super(ExceptionCodeHelper.getInstance().getServiceExceptionMessage(code.toLowerCase()));
        this.innerException = innerException;
        this.code = code;
        this.data = data;
    }

    public Exception getInnerException() {
        return this.innerException;
    }

    public String getCode() {
        return this.code;
    }

    public Object getData() {
        return this.data;
    }
}
